class Solution {
public:
    vector<vector<string>> groupAnagrams(vector<string>& strs) {
        unordered_map<string,vector<string>>arr;
        for(auto str:strs)
        {
            auto s=str;
            sort(str.begin(),str.end());
            arr[str].push_back(s);
        }
        vector<vector<string>>ret; 
        for(auto x:arr)
        {
            ret.push_back(x.second);
        }
        return ret; 
    }
};